<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    var str = "i come from beijing";
    function rev(char,s) {
			char = char.split(s).reverse().join(s);
			return char;
		}
    console.log(rev(str," "));
    
    var str = "i come from beijing";
		// 转数组、倒置、转字符串
		str = str.split(" ").reverse().join(" ");
		console.log(str);
  </script>
</head>
<body>
  
</body>
</html>